package com.sirui.x.busi.service.imp;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sirui.x.busi.feign.OrderFeign;
import com.sirui.x.busi.feign.StorageFeign;
import com.sirui.x.busi.service.BusinessService;

import io.seata.spring.annotation.GlobalTransactional;

@Service
public class BusinessServiceImp implements BusinessService {

	@Autowired
	private StorageFeign storageService;
	@Autowired
	private OrderFeign orderService;

	/**
	 * 采购
	 */
	@Override
	@GlobalTransactional
	public void purchase(String userId, String commodityCode, int orderCount) {

		storageService.deduct(commodityCode, orderCount);

		orderService.create(userId, commodityCode, orderCount);

		System.out.println(1);

		System.out.println("===");
	}

}
